//
//  MTDiscoverAPI.swift
//  MT
//
//  Created by ooops on 2020/5/18.
//  Copyright © 2020 张强. All rights reserved.
//

import Foundation
import Moya
import DeviceKit
import SwiftyRSA
import Security

import Result

enum MTDiscoverAPI {
    /// 获取实力 / 魅力排行榜榜首数据
    case rankingChampion
    /// 魅力排行榜
    case charmRankingList
    /// 实力排行榜
    case strengthRaningList
}

// MARK: ------------------  ----------------------
extension MTDiscoverAPI: MTTargetType {
    /// 请求头
    var headers: [String : String]? {
        //return ["Access-Token": "I6w6XbQSWNQIsnB9zKFbtV7b"]
        return ["Access-Token": UserDefaults.MTUserCenter.token.storedString ?? ""]
    }

    /// 基路径
    public var baseURL: URL {
        return URL(string: AuthServerBaseUrl)!
    }
    
    /// 路径
    public var path: String {
        switch self {
        case .rankingChampion:
            return "/ranking/ranking-one"
        case .charmRankingList:
            return "/ranking/charm-ranking-list"
        case .strengthRaningList:
            return "/ranking/strength-ranking-list"
        }
    }
    
    /// 请求方法
    public var method: Moya.Method {
        return .post
    }
    
    /// 参数
    var params: [String: Any]? {
        switch self {
        case .rankingChampion:
            return nil
        case .charmRankingList:
            return nil
        case .strengthRaningList:
            return nil
        }
    }
    
}
